﻿#Requires AutoHotkey v2.0
#Include "..\func.ahk"

; 启用正则表达式
; SetTitleMatchMode "RegEx"

; Rime同步
if DirExist(rime) {
	RunWait rime . "WeaselDeployer.exe /sync", rime
}

; 将用户词库推送至仓库
if DirExist(rime_usr) {
	commitInfo := FormatTime(, "yyyy-MM-dd_HHmm") . "_ms"
	Sleep 1000
	RunWait "git add ./sync", rime_usr
	RunWait "git commit -m `"" . commitInfo . "`"", rime_usr
	RunWait "git push origin `"master`"", rime_usr
}

; 重新创建计划任务
Run "schtasks /create /tn `"cron`" /tr `"autohotkey.exe " . A_ScriptDir . "\rime.ahk`" /sc onidle /i 15 /rl highest /f"